<?php
require_once 'conexao.php';

$placa = $_POST['placa'];

$query = "SELECT dt_saida, motorista, cracha, capacete, operacao FROM prestador WHERE id = (SELECT MAX(id) FROM prestador Where placa = '" . $placa . "')";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);

if($row['dt_saida'] == '0000-00-00')
{
    echo "0-" . $row['motorista'] . "-" . $row['cracha'] . "-" . $row['capacete'] . "-" . $row['operacao'];
}
else
{
    echo "1";
}
?>
